package com.srlg.batch.user;

import java.util.Date;

import com.srlg.batch.model.entity.User;
import org.springframework.batch.item.file.mapping.FieldSetMapper;
import org.springframework.batch.item.file.transform.FieldSet;
import org.springframework.validation.BindException;

public class UserFieldSetMapper implements FieldSetMapper<User> {
    @Override
    public User mapFieldSet(FieldSet fs) throws BindException {

        User user = new User();
        user.setName(fs.readString("姓名"));
        user.setSex(fs.readString("性别"));
        user.setAge(fs.readInt("年龄"));
        user.setAddress(fs.readString("地址"));
        user.setStatus((byte) 0);

        return user;
    }
}
